home *** CD-ROM | disk | FTP | other *** search
- Path: cls.net!news
- From: damian@sup.de (Damian Gruszka)
- Newsgroups: comp.lang.c
- Subject: Re: Help ! Please help me solve the problem
- Date: 21 Mar 1996 18:52:07 GMT
- Organization: sup.de
- Message-ID: <4is8gn$odj@freeside.cls.de>
- References: <4iqqb2$bkf@ctylnk.cityu.edu.hk>
- NNTP-Posting-Host: kldos3.sup.de
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.93.11
-
- In article <4iqqb2$bkf@ctylnk.cityu.edu.hk>, 00842506@cpccux0.cityu.edu.hk
- says...
- >
- > I want to write a disk cache program and so must place my new interrupt
- > point into interrupt vector 13 which points to my new function.
- >
- > Please take a look at my simple test program please:
- >
- > unsign long old_int_pointer;
- >
- > new_int_function()
- > {
- >
- >
- > /* just jump to old_int_pointer which read from disk
- > because it is a test program so nothing others is done */
- >
- > }
- >
- > main()
- > {
- > /* save old int13 pointer into old_int_pointer
- > using int21h ax=3513 */
- >
- > /* put address of new_int_function() into vector 13 area
- > using int21h ax=2513 */
- >
- > /* TSR function goes here */
- >
- > }
- >
- > Save and put new interrupt address and TSR is OK.
- >
- > However when disk reading is involved, it hangs.
- >
- > My problem is :
- > 1) what code should write so it can jump to my
- > old_int_pointer. I have though for a long time!! :-(
- > 2) I am afraid that when control is passed to new_int_function,
- > it can not retrieve values such as old_int_pointer because
- > the segment register may not match as that in my program.
- >
- > Please send me a mail if you have any idea.
- > Thanks a lot !! :-)
- >
- > N.Cheung
- > 00842506@cpccux0.cityu.edu.hk
- >
- >
- Try something like this (using Borland's BCC or Watcom C)
-
-
- #include <dos.h>
- /* some others includes */
-
- void interrupt (*old_int_ptr)(void);
-
- void interrupt __loadds new_int_func(void){
- old_int_ptr();
- }
-
- int main(){
-
- old_int_ptr = getvect(0x13);
- setvect(0x13);
- while(TRUE);/* ;-)) */
- }
-
- Alternatively you can declare old_int_ptr as __cs variable.
-
-
- D.Gruszka
- damian@sup.de
-
-